class HHGBFire extends BaseProjectileFire;

function DoFireEffect()
{
	SetTimer(0.3,false);
}

function Timer()
{
    local Vector StartProj, StartTrace, X,Y,Z;
    local Rotator Aim;
    local Vector HitLocation, HitNormal;
    local Actor Other;

    Instigator.MakeNoise(1.0);
    Weapon.GetViewAxes(X,Y,Z);

    StartTrace = Instigator.Location + Instigator.EyePosition();// + X*Instigator.CollisionRadius;
    StartProj = StartTrace + X*ProjSpawnOffset.X;
    if ( !Weapon.WeaponCentered() )
	    StartProj = StartProj + Weapon.Hand * Y*ProjSpawnOffset.Y + Z*ProjSpawnOffset.Z;

    // check if projectile would spawn through a wall and adjust start location accordingly
    Other = Weapon.Trace(HitLocation, HitNormal, StartProj, StartTrace, false);

    if (Other != None)
		StartProj = HitLocation;

    Aim = AdjustAim(StartProj, AimError);
	SpawnProjectile(StartProj, Aim);
	Weapon.GoToState('KillSelf');

    if( Weapon.ammoAmount(0) <= 0 && Instigator != none && Instigator.Controller != none )
    {
        Weapon.Destroy();
        Instigator.Controller.ClientSwitchToBestWeapon();
    }
}

defaultproperties
{
     FireAnim="Toss"
     FireRate=2.500000
     AmmoClass=Class'PerksSimHostOrg.HHGBAmmo'
     AmmoPerFire=1
     ProjectileClass=Class'PerksSimHostOrg.HGrenadeB'
}
